<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="stylesheet" href="/css/index.css">
</head>

<body>
    <div th:fragment="nav">
        <!--导航模块-->
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">校园社区首页</span>
                    </button>
                    <a class="navbar-brand" href="/">校园社区首页</a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <form class="navbar-form navbar-left">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Search">
                        </div>
                        <button type="submit" class="btn btn-default">搜索</button>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                        <!--授权github登录-->
                        <!--<a href="https://github.com/login/oauth/authorize?client_id=xxx&redirect_uri=http://localhost:8080/callback&scope=user&state=1">登录</a>-->
                        <!--th:if="${session.user != null}"-->
                        <li th:if="${session.user} != null">
                            <a href="/askquestion">提出问题</a>
                        </li>
                        <!--通知-->
                        <li>
                            <a href="/profile/reply">通知<span class="badge">12</span></a>
                        </li>

                        <li class="dropdown" th:if="${session.user != null}" >
                            <!--用户名-->
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="padding-top: 0px;">
                                <img class="media-object1 img-circle" th:src="${session.user.getAvatarUrl()}" alt="...">
                                <span th:text="${session.user.getLoginName()}"></span>
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="/profile/question">我的问题</a></li>
                                <li><a href="#">个人资料</a></li>
                                <li><a href="/logout">退出登录</a></li>
                            </ul>
                        </li>
                        <!--th:if="${session.user == null}"-->
                        <li th:if="${session.user == null}">
                            <!--<a href="https://github.com/login/oauth/authorize?client_id=e9011ece7cf514d9040c&redirect_uri=http://localhost:8081/callback&scope=user&state=1">登录</a>-->
                            <a href="https://gitee.com/oauth/authorize?client_id=970d4ba34d1e302fbc1d09024a1a86e60fb3f8f6da72072ee769360b2ec1d42e&redirect_uri=http://localhost:8081/callback&response_type=code">登录</a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</body>
</html>